
#pragma once

#include <IrrlichtDevice.h>
using namespace irr;

#include "VideoDriver.h"
#include "OSOperator.h"
#include "Timer.h"

namespace Irrlicht
{
	namespace Net
	{
		public ref class Device : public ReferenceCounted
		{
		private:
			IrrlichtDevice* insider;

		public:
			static Device^ Create()
			{
				return gcnew Device(createDevice());
			}

			Device(IrrlichtDevice* id) : ReferenceCounted(id)
			{
				insider = id;				
			}
			~Device()
			{
				insider->drop();
				delete insider;
			}

			bool Run()
			{
				return insider->run();
			}
			void Yield()
			{
				insider->yield();
			}

			void Sleep(unsigned int timeMs, bool pauseTimer)
			{
				insider->sleep(timeMs, pauseTimer);
			}
			
			property Video::VideoDriver^ VideoDriver
			{
				Video::VideoDriver^ get()
				{
					return gcnew Video::VideoDriver(insider->getVideoDriver());
				}
			}


			
			property Net::OSOperator^ OSOperator
			{
				Net::OSOperator^ get()
				{
					return gcnew Net::OSOperator(insider->getOSOperator());
				}
			}
			property Net::Timer^ Timer
			{
				Net::Timer^ get()
				{
					return gcnew Net::Timer(insider->getTimer());
				}
			}
			
			property String^ WindowCaption
			{
				void set(String^ text)
				{
					//insider->setWindowCaption(MarshalString(text));
				}
			}

			property bool IsWindowActive
			{
				bool get()
				{
					return insider->isWindowActive();
				}
			}
			property bool IsWindowFocused
			{
				bool get()
				{
					return insider->isWindowFocused();
				}
			}
			property bool IsWindowMinimized
			{
				bool get()
				{
					return insider->isWindowMinimized();
				}
			}
			property bool IsFullscreen
			{
				bool get()
				{
					return insider->isFullscreen();
				}
			}

			//SOMETHING
			
			property String^ Version
			{
				String^ get()
				{
					return gcnew String(insider->getVersion());
				}
			}
			property bool Resizable
			{
				void set(bool resize)
				{
					insider->setResizable(resize);
				}
			}

			void MinimizeWindow()
			{
				insider->minimizeWindow();
			}
			void MaximizeWindow()
			{
				insider->maximizeWindow();
			}
			void RestoreWindow()
			{
				insider->restoreWindow();
			}
			
			//SOMETHING
			
			void ClearSystemMessages()
			{
				insider->clearSystemMessages();
			}
		};
	}
}